+2004-07-27 Anders Carlsson <andersca@gnome.org>
+
+ * demos/gtk-demo/iconview.c: (do_iconview):
+ * gdk/gdkdrawable.h:
+ * gdk/linux-fb/gdkdrawable-fb2.c:
+ (gdk_draw_rectangle_alpha_libgtk_only):
+ * gdk/win32/gdkdrawable-win32.c:
+ (gdk_draw_rectangle_alpha_libgtk_only):
+ * gdk/x11/gdkdrawable-x11.c: (gdk_x11_draw_image),
+ (get_impl_drawable), (gdk_x11_draw_pixbuf),
+ (gdk_draw_rectangle_alpha_libgtk_only):
+ Add gdk_draw_rectangle_alpha_libgtk_only which uses
+ XRenderFillRectangle on X11. It's stubbed out on the
+ Win32 and fb backends.
+
+ * gtk/gtkiconview.c:
+ (gtk_icon_view_paint_rubberband):
+ Use gdk_draw_rectangle_alpha_libgtk_only here.
+
2004-07-27 Anders Carlsson <andersca@gnome.org>
* gtk/gtkaboutdialog.c: (gtk_about_dialog_init),
+2004-07-27 Anders Carlsson <andersca@gnome.org>
+
+ * demos/gtk-demo/iconview.c: (do_iconview):
+ * gdk/gdkdrawable.h:
+ * gdk/linux-fb/gdkdrawable-fb2.c:
+ (gdk_draw_rectangle_alpha_libgtk_only):
+ * gdk/win32/gdkdrawable-win32.c:
+ (gdk_draw_rectangle_alpha_libgtk_only):
+ * gdk/x11/gdkdrawable-x11.c: (gdk_x11_draw_image),
+ (get_impl_drawable), (gdk_x11_draw_pixbuf),
+ (gdk_draw_rectangle_alpha_libgtk_only):
+ Add gdk_draw_rectangle_alpha_libgtk_only which uses
+ XRenderFillRectangle on X11. It's stubbed out on the
+ Win32 and fb backends.
+
+ * gtk/gtkiconview.c:
+ (gtk_icon_view_paint_rubberband):
+ Use gdk_draw_rectangle_alpha_libgtk_only here.
+
2004-07-27 Anders Carlsson <andersca@gnome.org>
* gtk/gtkaboutdialog.c: (gtk_about_dialog_init),
+2004-07-27 Anders Carlsson <andersca@gnome.org>
+
+ * demos/gtk-demo/iconview.c: (do_iconview):
+ * gdk/gdkdrawable.h:
+ * gdk/linux-fb/gdkdrawable-fb2.c:
+ (gdk_draw_rectangle_alpha_libgtk_only):
+ * gdk/win32/gdkdrawable-win32.c:
+ (gdk_draw_rectangle_alpha_libgtk_only):
+ * gdk/x11/gdkdrawable-x11.c: (gdk_x11_draw_image),
+ (get_impl_drawable), (gdk_x11_draw_pixbuf),
+ (gdk_draw_rectangle_alpha_libgtk_only):
+ Add gdk_draw_rectangle_alpha_libgtk_only which uses
+ XRenderFillRectangle on X11. It's stubbed out on the
+ Win32 and fb backends.
+
+ * gtk/gtkiconview.c:
+ (gtk_icon_view_paint_rubberband):
+ Use gdk_draw_rectangle_alpha_libgtk_only here.
+
2004-07-27 Anders Carlsson <andersca@gnome.org>
* gtk/gtkaboutdialog.c: (gtk_about_dialog_init),
+2004-07-27 Anders Carlsson <andersca@gnome.org>
+
+ * demos/gtk-demo/iconview.c: (do_iconview):
+ * gdk/gdkdrawable.h:
+ * gdk/linux-fb/gdkdrawable-fb2.c:
+ (gdk_draw_rectangle_alpha_libgtk_only):
+ * gdk/win32/gdkdrawable-win32.c:
+ (gdk_draw_rectangle_alpha_libgtk_only):
+ * gdk/x11/gdkdrawable-x11.c: (gdk_x11_draw_image),
+ (get_impl_drawable), (gdk_x11_draw_pixbuf),
+ (gdk_draw_rectangle_alpha_libgtk_only):
+ Add gdk_draw_rectangle_alpha_libgtk_only which uses
+ XRenderFillRectangle on X11. It's stubbed out on the
+ Win32 and fb backends.
+
+ * gtk/gtkiconview.c:
+ (gtk_icon_view_paint_rubberband):
+ Use gdk_draw_rectangle_alpha_libgtk_only here.
+
2004-07-27 Anders Carlsson <andersca@gnome.org>
* gtk/gtkaboutdialog.c: (gtk_about_dialog_init),
fill_store (store);
icon_view = gtk_icon_view_new_with_model (GTK_TREE_MODEL (store));
+ gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (icon_view),
+ GTK_SELECTION_MULTIPLE);
g_object_unref (store);
/* Connect to the "clicked" signal of the "Up" tool button */
GdkRegion *gdk_drawable_get_clip_region (GdkDrawable *drawable);
GdkRegion *gdk_drawable_get_visible_region (GdkDrawable *drawable);
+
+gboolean gdk_draw_rectangle_alpha_libgtk_only (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ GdkColor *color,
+ guint16 alpha);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
}
#endif
+
+gboolean
+gdk_draw_rectangle_alpha_libgtk_only (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ GdkColor *color,
+ guint16 alpha)
+{
+ return FALSE;
+}
{
return GDK_DRAWABLE_HANDLE (drawable);
}
+
+gboolean
+gdk_draw_rectangle_alpha_libgtk_only (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ GdkColor *color,
+ guint16 alpha)
+{
+ return FALSE;
+}
gint height)
{
GdkDrawableImplX11 *impl;
-
+
impl = GDK_DRAWABLE_IMPL_X11 (drawable);
#ifdef USE_SHM
GdkDrawable *impl;
if (GDK_IS_WINDOW (drawable))
- impl = ((GdkPixmapObject *)drawable)->impl;
+ impl = ((GdkWindowObject *)drawable)->impl;
else if (GDK_IS_PIXMAP (drawable))
impl = ((GdkPixmapObject *)drawable)->impl;
else
rowstride,
dest_x, dest_y, width, height);
}
+
+/**
+ * gdk_draw_rectangle_alpha_libgtk_only:
+ * @drawable: The #GdkDrawable to draw on
+ * @x: the x coordinate of the left edge of the rectangle.
+ * @y: the y coordinate of the top edge of the rectangle.
+ * @width: the width of the rectangle.
+ * @height: the height of the rectangle.
+ * @color: The color
+ * @alpha: The alpha value.
+ *
+ * Tries to draw a filled alpha blended rectangle using the window
+ * system's native routines. This is not public API and must not be
+ * used by applications.
+ *
+ * Return value: TRUE if the rectangle could be drawn, FALSE
+ * otherwise.
+ **/
+gboolean
+gdk_draw_rectangle_alpha_libgtk_only (GdkDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ GdkColor *color,
+ guint16 alpha)
+{
+ Display *xdisplay;
+ XRenderColor render_color;
+ Picture pict;
+ int x_offset, y_offset;
+ GdkDrawable *real_drawable, *impl;
+
+ g_return_val_if_fail (color != NULL, FALSE);
+
+ if (!GDK_IS_WINDOW (drawable))
+ return FALSE;
+
+ if (!_gdk_x11_have_render (gdk_drawable_get_display (drawable)))
+ return FALSE;
+
+ gdk_window_get_internal_paint_info (GDK_WINDOW (drawable),
+ &real_drawable,
+ &x_offset, &y_offset);
+
+ impl = ((GdkWindowObject *)real_drawable)->impl;
+
+ pict = gdk_x11_drawable_get_picture (impl);
+
+ if (pict == None)
+ return FALSE;
+
+ xdisplay = GDK_DISPLAY_XDISPLAY (gdk_drawable_get_display (drawable));
+
+ render_color.alpha = alpha;
+ render_color.red = color->red * render_color.alpha / 0xffff;
+ render_color.green = color->green * render_color.alpha / 0xffff;
+ render_color.blue = color->blue * render_color.alpha / 0xffff;
+
+ XRenderFillRectangle (xdisplay,
+ PictOpOver, pict, &render_color,
+ x - x_offset, y - y_offset,
+ width, height);
+ return TRUE;
+}
gint press_start_x;
gint press_start_y;
#endif
-
+
/* Layout used to draw icon text */
PangoLayout *layout;
GdkEventButton *event);
static gboolean gtk_icon_view_button_release (GtkWidget *widget,
GdkEventButton *event);
-
/* GtkIconView signals */
static void gtk_icon_view_set_adjustments (GtkIconView *icon_view,
GtkAdjustment *hadj,
widget_class->motion_notify_event = gtk_icon_view_motion;
widget_class->button_press_event = gtk_icon_view_button_press;
widget_class->button_release_event = gtk_icon_view_button_release;
-
+
klass->set_scroll_adjustments = gtk_icon_view_set_adjustments;
klass->select_all = gtk_icon_view_real_select_all;
klass->unselect_all = gtk_icon_view_real_unselect_all;
widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_background (icon_view->priv->bin_window, &widget->style->base[widget->state]);
gdk_window_set_background (widget->window, &widget->style->base[widget->state]);
-
-
}
static void
return TRUE;
}
-
static void
gtk_icon_view_update_rubberband (gpointer data)
{
fill_color = gtk_gdk_color_to_rgb (fill_color_gdk) << 8 | fill_color_alpha;
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, rect.width, rect.height);
- gdk_pixbuf_fill (pixbuf, fill_color);
+ if (!gdk_draw_rectangle_alpha_libgtk_only (icon_view->priv->bin_window,
+ rect.x, rect.y, rect.width, rect.height,
+ fill_color_gdk,
+ fill_color_alpha << 8 | fill_color_alpha))
+ {
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, rect.width, rect.height);
+ gdk_pixbuf_fill (pixbuf, fill_color);
+
+ gdk_draw_pixbuf (icon_view->priv->bin_window, NULL, pixbuf,
+ 0, 0,
+ rect.x,rect.y,
+ rect.width, rect.height,
+ GDK_RGB_DITHER_NONE,
+ 0, 0);
+ g_object_unref (pixbuf);
+ }
- gdk_draw_pixbuf (icon_view->priv->bin_window, NULL, pixbuf,
- 0, 0,
- rect.x,rect.y,
- rect.width, rect.height,
- GDK_RGB_DITHER_NONE,
- 0, 0);
- g_object_unref (pixbuf);
gc = gdk_gc_new (icon_view->priv->bin_window);
gdk_gc_set_rgb_fg_color (gc, fill_color_gdk);
gdk_gc_set_clip_rectangle (gc, &rect);